
var columns = [{
	    id: "#",
	    name: "",
	    width: 40,
	    behavior: "selectAndMove",
	    unselectable: true,
	    resizable: false,
	    cssClass: "cell-reorder"
	}, {
	    id: "no",
	    name: "序号",
	    field: "no",
	    width: 50,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "name1",
	    name: "姓名",
	    field: "name",
	    width: 60,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "d1",
	    name: "应出勤",
	    field: "d1",
	    width: 50,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "d2",
	    name: "实出勤",
	    field: "d2",
	    width: 50,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "d3",
	    name: "迟到/未打卡",
	    field: "d3",
	    width: 50,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "d4",
	    name: "事假",
	    field: "d4",
	    width: 50,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "s1",
	    name: "基本工资",
	    field: "s1",
	    width: 80,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "s2",
	    name: "加班费",
	    field: "s2",
	    width: 80,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "k1",
	    name: "社保",
	    field: "k1",
	    width: 80,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "k2",
	    name: "事病/迟到",
	    field: "k2",
	    width: 80,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "name",
	    name: "姓名",
	    field: "name",
	    width: 60,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "emp",
	    name: "工号",
	    field: "emp",
	    width: 50,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "t1",
	    name: "应发",
	    field: "t1",
	    width: 80,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "kd",
	    name: "个税",
	    field: "kd",
	    width: 80,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "t2",
	    name: "实发",
	    field: "t2",
	    width: 80,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "sj",
	    name: "银行",
	    field: "sj",
	    width: 70,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text,
	    validator: requiredFieldValidator
	}, {
	    id: "ns",
	    name: "现金",
	    field: "ns",
	    width: 70,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text,
	    validator: requiredFieldValidator
	}, {
	    id: "content",
	    name: "备注",
	    field: "content",
	    width: 50,
	    cssClass: "cell-title",
	    editor: Slick.Editors.Text
	}, {
	    id: "ok",
	    name: "",
	    field: "ok",
	    width: 40,
	    cssClass: "cell-effort-driven",	    
	    cannotTriggerInsert: true,
	    formatter: Slick.Formatters.YesNo,
	    editor: Slick.Editors.Checkbox
	}];

function BankSelectCellEditor(args) {
	var $select;
    var defaultValue;
    var scope = this;

    this.init = function() {
        $select = $("<SELECT tabIndex='0' id='bank_'></SELECT>");
        
        $select.empty();
        // alert(bank_json);
        $.each(bank_json, function(k, v) {
        	// alert(k + " = " + v);
        	var item = new Option(v, k);
        	$select[0].options.add(item);
        });
        
        $select.appendTo(args.container);        
        $select.focus();
    };

    this.destroy = function() {
        $select.remove();
    };

    this.focus = function() {
        $select.focus();
    };

    this.loadValue = function(item) {
    	var k = args.column.field;
    	$select.val(item[k]);
    	$select.select();
    };

    this.serializeValue = function() {
        return $select.val();
    };

    this.applyValue = function(item,state) { 
    	var k = args.column.field;
        // item[k] = state;
    	var s = $select.find("option:selected").text();
    	item[k] = state + ":" + s;
    };
   
    this.isValueChanged = function() {
        return ($select.val() != defaultValue);
    };

    this.validate = function() {
        return {
            valid: true,
            msg: null
        };
    };

    this.init();
}
